const express = require("express");
const router = express.Router();
const articlesCtrl = require("../controller/article");
const auth = require("../middleware/auth");
const articleValidator = require("../validator/article");

router.get("/", articlesCtrl.showIndex);

router.get("/editor", auth, articlesCtrl.showEditor);

router.get("/editor/:articleId", auth, articlesCtrl.showEditor);

router.get("/article/:articleId", auth, articlesCtrl.showArticle);

router.post(
  "/articles",
  auth,
  articleValidator.createArticle,
  articlesCtrl.createArticle
);

module.exports = router;
